package com.gxa.medical.controller;

import com.gxa.medical.service.DoctorFirstPageService;
import com.gxa.medical.service.DoctorService;
import com.gxa.medical.service.UserDetailsService;
import com.gxa.medical.util.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author Dusen
 * @date 2022/6/8 16:47
 */
@RestController
@RequestMapping("/doctorFirstPage")
@Api(value = "医生端的首页页面相关的api接口")
public class DoctorFirstPageController {
    @Autowired
    private DoctorFirstPageService doctorFirstPageService;

    @Autowired
    private UserDetailsService userDetailsService;

    @PostMapping("/countFromUser")
    @ApiOperation(value = "查询统计所有患者总个数的方法")
    /**
     * 查询统计所有患者总个数的方法
     */
    public Map countFromUser(){
        Integer count = userDetailsService.countAll();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(count);

        return jsonResult.getResultMap();
    }


    @PostMapping("/give")
    @ApiOperation(value = "查询统计该医生被关注的患者的总个数的方法")
    /**
     * 查询统计该医生被关注的患者的总个数的方法
     */
    public Map countGive(){
        Integer count = doctorFirstPageService.countGive();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(count);

        return jsonResult.getResultMap();
    }


    @PostMapping("/weekUser")
    @ApiOperation(value = "查询统计本周新增患者的总个数的方法")
    /**
     * 查询统计本周新增患者的总个数的方法
     */
    public Map countWeekUser(){
        Integer count = doctorFirstPageService.countWeekUser();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(count);

        return jsonResult.getResultMap();
    }


    @PostMapping("/weekGiveUser")
    @ApiOperation(value = "查询统计该医生本周新增关注的患者总个数的方法")
    /**
     * 查询统计该医生本周新增关注的患者总个数的方法
     */
    public Map countWeekGiveUser(){
        Integer count = doctorFirstPageService.countWeekGiveUser();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("200");
        jsonResult.setData(count);

        return jsonResult.getResultMap();
    }


}
